<template>
  <el-table :data="tableData" stripe style="width: 100%" show-summary>
    <el-table-column prop="select" label="全选" width="50" type="index" :index="indexMethod">
        <el-checkbox></el-checkbox>
    </el-table-column>
    <el-table-column prop="name" label="商品" width="280"></el-table-column>
    <el-table-column prop="price" label="单价" width="180"></el-table-column>
    <el-table-column label="数量" width="180" prop="num">
        <counter :cartData="tableData" @input="sendValue" v-model="num"></counter>
    </el-table-column>
    <el-table-column prop="num*price" label="小计" width="180"></el-table-column>
    <el-table-column prop="set" label="操作">
        <el-button type="primary">编辑</el-button>
        <el-button type="danger">删除</el-button>
    </el-table-column>
  </el-table>
</template>

<script>
import counter from "./counter"
export default {
    components:{
        counter
    },
    data() {
        return {
            tableData: [
                {
                    select: '',
                    name: '麦肯锡问题分析与解决技巧',
                    price:'34.60',
                    num:2
                },
                {
                    select: '',
                    name: '极简思维：颠覆传统思维模式的极简法则',
                    price:'31.50',
                    num:1
                },
                {
                    select: '',
                    name: '沃顿商学院最受欢迎的思维课+谈判课+哈佛商学院最受欢迎的营销课+领导',
                    price:'184.50',
                    num:1
                }
            ]
        }
    },
    methods:{
        sendValue(value){
            this.num = value;
            console.log(this);
        },
        getSum(){
            
        },
        indexMethod(){

        }
    }
}
</script>